<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('已办事项列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <p>事项标题：</p>
                            <input name="itemName" type="text"/>
                        </li>
                        <li>
                            <p>模块名称：</p>
                            <input name="module" type="text"/>
                        </li>
                        <!--<li>
                            <p>任务 ID：</p>
                            <input type="text" name="taskId"/>
                        </li>-->
                        <li>
                            <p>任务名称：</p>
                            <input name="taskName" type="text"/>
                        </li>
                        <!--<li>
                            <p>待办人 ID：</p>
                            <input type="text" name="todoUserId"/>
                        </li>-->
                        <li>
                            <p>待办人名称：</p>
                            <input name="todoUserName" type="text"/>
                        </li>
                        <!--<li>
                            <p>处理人 ID：</p>
                            <input type="text" name="handleUserId"/>
                        </li>-->
                        <li>
                            <p>处理人名称：</p>
                            <input name="handleUserName" type="text"/>
                        </li>
                        <li class="select-time">
                            <p>通知时间：</p>
                            <input class="time-input" id="todoItemStartTime" name="params[todoItemStartTime]"
                                   placeholder="开始时间" type="text"/>
                            <span>-</span>
                            <input class="time-input" id="todoItemEndTime" name="params[todoItemEndTime]"
                                   placeholder="结束时间" type="text"/>
                        </li>
                        <li class="select-time">
                            <p>处理时间：</p>
                            <input class="time-input" id="handleStartTime" name="params[handleStartTime]"
                                   placeholder="开始时间" type="text"/>
                            <span>-</span>
                            <input class="time-input" id="handleEndTime" name="params[handleEndTime]" placeholder="结束时间"
                                   type="text"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-warning" onclick="$.table.exportExcel()">
                <i class="fa fa-download"></i> 导出
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table" style="word-break:break-all; word-wrap:break-all;"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:src="@{/js/activiti.js}"></script>
<script th:inline="javascript">
    var prefix = ctx + "todoitem";

    $(function () {
        var options = {
            url: prefix + "/doneList",
            exportUrl: prefix + "/doneExport",
            modalName: "已办事项",
            columns: [{
                checkbox: true
            },
                {
                    field: 'id',
                    title: '主键 ID',
                    visible: false
                },
                {
                    field: 'itemName',
                    title: '事项标题'
                },
                {
                    field: 'itemContent',
                    title: '事项内容'
                },
                {
                    field: 'module',
                    title: '模块名称'
                },
                {
                    field: 'taskId',
                    title: '任务 ID',
                    visible: false
                },
                {
                    field: 'taskName',
                    title: '任务名称',
                    visible: false
                },
                {
                    field: 'isView',
                    title: '是否查看'
                },
                {
                    field: 'isHandle',
                    title: '是否处理'
                },
                {
                    field: 'todoUserId',
                    title: '待办人ID',
                    visible: false
                },
                {
                    field: 'todoUserName',
                    title: '待办人名称'
                },
                {
                    field: 'handleUserId',
                    title: '处理人ID',
                    visible: false
                },
                {
                    field: 'handleUserName',
                    title: '处理人名称'
                },
                {
                    field: 'todoTime',
                    title: '通知时间'
                },
                {
                    field: 'handleTime',
                    title: '处理时间'
                },
                {
                    field: 'nodeName',
                    title: '已办任务名称',
                    align: 'center',
                    formatter: function (value, row, index) {
                        return '<span class="badge badge-primary">' + value + '</span>';
                    }
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-primary btn-xs" href="javascript:void(0)" onclick="showFormDialog(\'' + row.instanceId + '\', \'' + row.module + '\')"><i class="fa fa-eye"></i> 申请详情</a> ');
                        actions.push('<a class="btn btn-warning btn-xs" href="javascript:void(0)" onclick="showHistoryDialog(\'' + row.instanceId + '\')"><i class="fa fa-list"></i> 审批历史</a> ');
                        actions.push('<a class="btn btn-info btn-xs" href="javascript:void(0)" onclick="showProcessImgDialog(\'' + row.instanceId + '\')"><i class="fa fa-image"></i> 进度查看</a> ');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });
</script>
</body>
</html>
